//
//  MLRequestOverlayView.h
//
//  Created by molon on 14/11/17.
//  Copyright (c) 2014年 molon. All rights reserved.
//

/**
 *  一般是进入列表页面第一次请求，不适宜下拉刷新用到的覆盖view
 */

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, MLRequestOverlayViewState) {
    MLRequestOverlayViewStateNormal = 0, //通常的
    MLRequestOverlayViewStateRequesting, //加载中
    MLRequestOverlayViewStateRequestFailed, //加载失败
};

@class MolonRequestHelper;
@interface MLRequestOverlayView : UIView

/**
 *  是否可穿透
 */
@property (nonatomic, assign) BOOL penetrable;

/**
 *  是否忽略失败，说白了忽略就是只留加载中样式功能
 */
@property (nonatomic, assign) BOOL ignoreFailed;

/**
 *  只做监控状态，不作投递
 */
@property (nonatomic, strong) MolonRequestHelper *bindHelper;

/**
 *  是否忽略预加载
 */
@property (nonatomic, assign) BOOL ignorePreload;

/**
 *  overlayView状态，一般外部调用是在不用bindHelper场景下
 */
@property (nonatomic, assign) MLRequestOverlayViewState state;

/**
 *  点击重试按钮的block,一般用来执行调用请求，因为本View并不作投递
 */
@property (nonatomic, copy) void (^didClickRetryButtonBlock)(MLRequestOverlayView *view);

/**
 *  可以得到error的block
 */
@property (nonatomic, copy) void (^didGetErrorBlock)(MLRequestOverlayView *view,NSDictionary *error);

/**
 *  根据状态自定义提示文字
 */
@property (nonatomic, copy) NSString*(^customTipsForStateBlock)(MLRequestOverlayView *view,MLRequestOverlayViewState state);

/**
 *  执行didClickRetryButtonBlock
 */
- (void)validate;

/**
 *  设置didClickRetryButtonBlock，然后执行一次它
 */
- (void)validateWithDidClickRetryButtonBlock:(void (^)(MLRequestOverlayView *view))didClickRetryButtonBlock;

@end
